<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            background: url('./images/desktop_1.jpg') no-repeat top center/cover;
        }
    </style>
</head>

<body>
    <script>
        // 随机生成n-m的函数
        function getNtoM(m = 0, n = 0) {
            return Math.floor(Math.random() * (m - n + 1)) + n
        }

        // 获得随机数
        const random = getNtoM(1, 10)
        // 更换路径
        document.body.style.backgroundImage = `url('./images/desktop_${random}.jpg') `

    </script>
</body>

</html>